<?php
namespace app\index\controller;
use think\Config;
use think\Env;
use think\Request;
use think\Controller;
use think\Db;
use app\index\model\Send;
use app\index\model\UserModel;
use app\admin\model\NewsModel;
use think\Route;
error_reporting(0);
class Index extends Controller
{
//短信验证
	public function sms()
	{
		if(request()->isPost()){
			$Send = new Send;
			$result = $Send->sms([
				'param'  => ['code'=>'123456','product'=>'安德兔'],
				'mobile'  => input('post.mobile/s','','trim,strip_tags'),
				'template'  => 'SMS_12940581',
				]);
			if($result !== true){
				return $this->error($result);
			}
			return $this->success('短信下发成功！');
		}
		return $this->fetch();
	}
//多语言
	public function lang() {
		switch ($_GET['lang']) {
			case 'cn':
			cookie('think_var', 'zh-cn');
			break;
			case 'en':
			cookie('think_var', 'en-us');
			break;
	        //其它语言
		}
	}
//华为商城
	public function mall(Request $request)
	{
		
		return $this->fetch('index/mall');
	}
//首页面
	public function index(Request $request)
	{
		
		return $this->fetch('index/index');
	}
//introduction
	public function introduction(Request $request)
	{
		
		return $this->fetch('index/introduction');
	}
//manage
	public function manage(Request $request)
	{
		
		return $this->fetch('index/manage');
	}
//news
	public function news(Request $request)
	{
		
		$data=NewsModel::paginate(3);
		$page=$data->render();
		$this->assign('data',$data);
		$this->assign('page',$page);
		return $this->fetch('index/news');
	//	$this->redirect('index/news.php');
	}
//user
	public function user(Request $request)
	{
		
		return $this->fetch('index/user');
	}
//login
	public function login()
	{

		return $this->fetch('login/login');
	}
//register
	public function register()
	{
		
		return $this->fetch('login/register');
	}
/*	public function register1()
	{
		
		return $this->fetch('login/register1');
	}*/

}
